global.BASE_DIR = __dirname;
global.CONF = BASE_DIR + '/conf/';
global.STATIC = BASE_DIR + '/static/';
global.VIEW = BASE_DIR + '/views/';


var http = require('http'),
  fs = require('fs'),
  url = require('url'),
  staticModule = require('./modules/static_Module.js'),
  indexModule = require('./modules/index_Module.js');

http.createServer(function(req, res) {
  var pathname = url.parse(req.url).pathname;
  var readPath = __dirname + '/static' + pathname;
  if (pathname == '/favicon.ico') {
    return;
  } else if (pathname == '/index' || pathname == '/') {
    indexModule.goIndex(res);
  } else {
    staticModule.getStaticFile(pathname, res, req);
  }
}).listen(3000);
console.log('server start at http://localhost:3000');
